<?php
/**
 * Acl动作
 * 
 * @since 0.1
 * @package net.4kiki.acl
 */
class IAclAction extends IObject {
	private $name;
	private $resourceRef;
	
	/**
	 * 构造器
	 *
	 * @param IAclResource $resource 所属资源
	 * @param string $name 动作名
	 * @since 0.1
	 */
	public function __construct(IAclResource $resource, $name) {
		$this->name = $name;
		$this->setResource($resource);
	}
	
	/**
	 * 设置所属的资源
	 *
	 * @param IAclResource $resource 资源
	 * @since 0.1
	 */
	public function setResource(IAclResource $resource) {
		$this->resourceRef = IObjectFactory::addRef($resource); 
	}
	
	/**
	 * 取得所属的资源
	 *
	 * @return IAclResource
	 * @since 0.1
	 */
	public function getResource() {
		return IObjectFactory::getRef($this->resourceRef);
	}
	
	/**
	 * 取得名称
	 *
	 * @return string
	 * @since 0.1
	 */
	public function getName() {
		return $this->name;
	}
	
	/**
	 * 取得ID
	 *
	 * @return string
	 * @since 0.1
	 */
	public function getId() {
		return $this->resourceRef . "." . $this->name;
	}
}

?>